#!/usr/bin/env python
# -*- coding:utf-8 -*-
import requests

if __name__ == "__main__":
    url = "https://www.sogou.com/web"
    kw = input("enter a word:")
    param = {
        "query": kw
    }
    headers = {
        'user-agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36',
    }
    response = requests.get(url=url, params=param, headers=headers)
    page_text = response.text
    fileName = kw + ".html"
    with open(fileName, 'w', encoding='utf-8') as fp:
        fp.write(page_text)
    print(fileName, "保存OK！！")
